<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <title>听课人数统计信息</title>
    <?php PrintPageHead(); ?>
    <link href="../resource/css/hermes.css" rel="stylesheet">
    <link href="../resource/js/calendar/calendar-blue.css" type="text/css" rel="stylesheet">
    <script src="../resource/js/calendar/calendar.js" type="text/javascript"></script>
    <script src="../resource/js/hermes.js"></script>
    <style type="text/css">
        .divleft{width: 15%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divleft2{width: 70%; float: left; text-align:left; border-right: solid 1px #d5d5d5; margin-right: 2% }
        .divright{ width: 8%; float:right; text-align: right;}


    </style>
    <?php
    if (!array_key_exists("公众号ID",$_SESSION)) {
        header("Location:back.php");
    }
    if(count($_POST)>0){
        $title=trim($_POST['title']);
        if(!pdo()->selectOne("select * from `语音课程` where title='".$title."'")){
            echo "<script>alert('课程不存在');history.back();</script>";
        }
        $sql = "SELECT count(q.用户ip) as qcount FROM `语音课程` k left join `群离线` q on k.`群id`=q.`群id` and `用户ip` is not null where title='".$title."' group by k.`群id`";
        $res = pdo()->selectOne($sql);

    }


    ?>
</head>
<body>

<?php include_once 'back_header.php'; ?>

<div class="panel panel-primary">
    <div class="panel-heading text-center"><h3 class="panel-title">听课人数统计信息</h3></div>

    <ul class="nav nav-pills" style="margin:20px">
        <li role="presentation"    ><a href="../back.php?state=back14tongjibingli&order=0">病历统计信息</a></li>
        <li role="presentation"  ><a href="../back.php?state=back14tongjikecheng&order=0">课程统计信息</a></li>
        <li role="presentation" class="active" ><a href="../back.php?state=back14tongjitingke">听课人数统计信息</a></li>


    </ul>

    <form class="form-inline" action="../back.php?state=back14tongjitingke" method="post" style="width: 500px;
display: block;
margin: 20px auto;">
        <div class="form-group">
            <label class="sr-only" for="exampleInputEmail3" style="vertical-align: middle;">课程名称</label>
            <input type="text" class="form-control" name="title" value="" id="exampleInputEmail3" placeholder="请输入课程名称">
        </div>
        <button type="submit" class="btn btn-default">查询</button>

        <?php
        if(count($_POST)>0) {
            ?>
            <div style="margin:30px 0px;">当前听课《<?php echo $title;; ?>》人数为<?php echo $res['qcount']; ?>人</div>
            <?php
        }
        ?>
    </form>

</div>



<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="../resource/js/jquery-1.11.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="../resource/js/bootstrap.min.js"></script>

</body>
</html>